/*
 * @Author: WangLi
 * @Date: 2021-07-14 22:44:55
 * @LastEditors: WangLi
 * @LastEditTime: 2021-07-16 08:29:00
 * @Description:
 */
const { series, parallel, src, dest, watch } = require("gulp");
const sass = require("gulp-sass")(require("node-sass"));
const rename = require("gulp-rename");
const scssFiles = ["**/*.scss", "!node_modules/**", "!**/_*.scss"];
const buildWxss = function () {
  return src(scssFiles)
    .pipe(sass().on("error", sass.logError))
    .pipe(rename({ extname: ".wxss" }))
    .pipe(dest("./", { overwrite: true }));
};

module.exports = {
  dev: series(buildWxss, () => {
    watch(scssFiles, buildWxss);
  }),
  build: buildWxss,
};
